﻿<Window x:Class="PurchaseWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended" 
         xmlns:lib="clr-namespace:HMSLibrary;assembly=HMSLibrary"
    SizeToContent="WidthAndHeight" WindowStyle="None" AllowsTransparency="True" Icon="/Horizon.HMS;component/Images/POSIcon.ico"
    xmlns:local="clr-namespace:Horizon.HMS" WindowStartupLocation="CenterScreen" Background="Transparent">
    <Border Background="White" BorderBrush="Navy" BorderThickness="2" CornerRadius="10"
             xmlns:my="http://schemas.microsoft.com/wpf/2008/toolkit">
        <Grid Margin="10" Background="{StaticResource WindowBackground}">
            <Grid.RowDefinitions>
                <RowDefinition Height="30"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>
            <TextBlock Margin="20,2" FontSize="16" FontWeight="SemiBold" Foreground="{StaticResource TextLabelColor}">
              <Run Text="HMS (" />
            <Run Text="Your management partner..." FontSize="10" FontStyle="Italic"/>
            <Run Text=")" />
            <Run Text=" :: "/>
            <Run Name="ModuleNameRun"/>
            </TextBlock>
            <Button Grid.Column="2" Style="{DynamicResource CloseButtonStyle}" Width="11.195" Content="Button" x:Name="CloseButton" Cursor="Hand" HorizontalAlignment="Right" Margin="0,5.583,7.468,0" VerticalAlignment="Top" Height="12.77"/>
            <Button Grid.Column="2" Style="{DynamicResource MinimizeButtonStyle}" Width="12.402" Content="Button" x:Name="MinimizeButton" Cursor="Hand" HorizontalAlignment="Right" Margin="0,4.733,24.606,0" VerticalAlignment="Top" Height="13.537"/>
            <Path Data="M18,115 L616,115" Fill="#FFF4F4F5" Height="1" Margin="5" Width="800" Stretch="Fill" Stroke="White" Grid.Row="1" Grid.ColumnSpan="2"/>
            <Grid Grid.Row="2" Name="MainStack" Margin="10">
                <Grid.RowDefinitions>
                    <RowDefinition Height="28"/>
                    <RowDefinition Height="28"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="300"/>
                    <RowDefinition Height="120"/>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="500"/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>
                <TextBlock Name="NoTextBlock" Text="Invoice No.:" Style="{StaticResource TextBlockStyle}"/>
                <TextBox  Grid.Column="1" Margin="2" Name="InvoiceNoTextBox"/>
                <TextBlock Text="Vendor Name:" Grid.Row="1" Style="{StaticResource TextBlockStyle}"/>
                <ComboBox Grid.Column="1" Grid.Row="1" Margin="2" Name="VendorComboBox" DisplayMemberPath="Name" SelectedValuePath="ID"/>
                <TextBlock Text="Date:" Grid.Column="2" Style="{StaticResource TextBlockStyle}"/>
                <DatePicker Grid.Column="3" Height="28" Name="BillDatePicker" />
                <my:DataGrid AutoGenerateColumns="False" Grid.ColumnSpan="4" Grid.Row="3" RowHeight="25" Margin="5" Name="BillItemsDataGrid" Height="400">
                    <my:DataGrid.Columns>
                        <my:DataGridTemplateColumn Header="Item Name" Width="200">
                            <my:DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <TextBlock Text="{Binding ItemName, Mode=TwoWay}"/>
                                </DataTemplate>
                            </my:DataGridTemplateColumn.CellTemplate>
                            <my:DataGridTemplateColumn.CellEditingTemplate>
                                <DataTemplate>
                                    <TextBox Name="ItemNameTextBox" Text="{Binding ItemName, Mode=TwoWay}" KeyUp="ItemNameTextBox_KeyUp"/>
                                </DataTemplate>
                            </my:DataGridTemplateColumn.CellEditingTemplate>
                        </my:DataGridTemplateColumn>
                        <my:DataGridTemplateColumn Header="Description" Width="200">
                            <my:DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <TextBlock Text="{Binding Description, Mode=TwoWay}"/>
                                </DataTemplate>
                            </my:DataGridTemplateColumn.CellTemplate>
                            <my:DataGridTemplateColumn.CellEditingTemplate>
                                <DataTemplate>
                                    <TextBox Text="{Binding Description, Mode=TwoWay}"/>
                                </DataTemplate>
                            </my:DataGridTemplateColumn.CellEditingTemplate>
                        </my:DataGridTemplateColumn>
                        <my:DataGridTemplateColumn Header="Qty" Width="60" >
                            <my:DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <TextBlock Text="{Binding Qty, Mode=TwoWay}" TextAlignment="Right"/>
                                </DataTemplate>
                            </my:DataGridTemplateColumn.CellTemplate>
                            <my:DataGridTemplateColumn.CellEditingTemplate>
                                <DataTemplate>
                                    <TextBox Text="{Binding Qty, Mode=TwoWay}" TextAlignment="Right"/>
                                </DataTemplate>
                            </my:DataGridTemplateColumn.CellEditingTemplate>
                        </my:DataGridTemplateColumn>
                        <my:DataGridTemplateColumn Header="Unit" Width="60">
                            <my:DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <TextBlock Text="{Binding UOMName, Mode=TwoWay}"/>
                                </DataTemplate>
                            </my:DataGridTemplateColumn.CellTemplate>
                            <my:DataGridTemplateColumn.CellEditingTemplate>
                                <DataTemplate>
                                    <TextBox Name="UOMNameTextBox" Text="{Binding UOMName, Mode=TwoWay}" KeyUp="UOMNameTextBox_KeyUp"/>
                                </DataTemplate>
                            </my:DataGridTemplateColumn.CellEditingTemplate>
                        </my:DataGridTemplateColumn>
                        <my:DataGridTemplateColumn Header="Rate" Width="80" >
                            <my:DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <TextBlock Text="{Binding Rate, Mode=TwoWay}" TextAlignment="Right"/>
                                </DataTemplate>
                            </my:DataGridTemplateColumn.CellTemplate>
                            <my:DataGridTemplateColumn.CellEditingTemplate>
                                <DataTemplate>
                                    <TextBox Text="{Binding Rate, Mode=TwoWay}" TextAlignment="Right"/>
                                </DataTemplate>
                            </my:DataGridTemplateColumn.CellEditingTemplate>
                        </my:DataGridTemplateColumn>
                        <my:DataGridTemplateColumn Header="Amount" Width="120" IsReadOnly="True">
                            <my:DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <TextBlock Text="{Binding Amount, Mode=TwoWay}" TextAlignment="Right"/>
                                </DataTemplate>
                            </my:DataGridTemplateColumn.CellTemplate>
                        </my:DataGridTemplateColumn>
                    </my:DataGrid.Columns>
                </my:DataGrid>
                <Grid Grid.Row="4" Grid.ColumnSpan="4">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="435"/>
                        <ColumnDefinition Width="140"/>
                        <ColumnDefinition Width="150"/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="28"/>
                        <RowDefinition Height="28"/>
                        <RowDefinition Height="28"/>
                        <RowDefinition Height="28"/>
                    </Grid.RowDefinitions>
                    <StackPanel Orientation="Horizontal" Grid.RowSpan="4" Name="RemarksStackPanel">
                        <TextBlock Text="Remarks :" Style="{StaticResource TextBlockStyle}"/>
                        <TextBox Height="105" Width="370" Margin="2" AcceptsReturn="True" TextWrapping="Wrap"/>
                    </StackPanel>
                    <my:DataGrid AutoGenerateColumns="False" Margin="5" Name="TaxDiscountDataGrid" Visibility="Collapsed" Grid.RowSpan="3">
                        <my:DataGrid.Columns>
                            <my:DataGridTemplateColumn Header="Tax/Discount" Width="200">
                                <my:DataGridTemplateColumn.CellTemplate>
                                    <DataTemplate>
                                        <TextBlock Text="{Binding TaxDiscName, Mode=TwoWay}"/>
                                    </DataTemplate>
                                </my:DataGridTemplateColumn.CellTemplate>
                                <my:DataGridTemplateColumn.CellEditingTemplate>
                                    <DataTemplate>
                                        <TextBox Name="TaxDiscountTextBox" Text="{Binding TaxDiscName, Mode=TwoWay}" KeyUp="TaxDiscountTextBox_KeyUp"/>
                                    </DataTemplate>
                                </my:DataGridTemplateColumn.CellEditingTemplate>
                            </my:DataGridTemplateColumn>
                            <my:DataGridTemplateColumn Header="Rate" Width="60" >
                                <my:DataGridTemplateColumn.CellTemplate>
                                    <DataTemplate>
                                        <TextBlock Text="{Binding Rate, Mode=TwoWay}" TextAlignment="Right"/>
                                    </DataTemplate>
                                </my:DataGridTemplateColumn.CellTemplate>
                                <my:DataGridTemplateColumn.CellEditingTemplate>
                                    <DataTemplate>
                                        <TextBox Text="{Binding Rate, Mode=TwoWay}" TextAlignment="Right"/>
                                    </DataTemplate>
                                </my:DataGridTemplateColumn.CellEditingTemplate>
                            </my:DataGridTemplateColumn>
                            <my:DataGridTemplateColumn Header="Amount" Width="100" IsReadOnly="True">
                                <my:DataGridTemplateColumn.CellTemplate>
                                    <DataTemplate>
                                        <TextBlock Text="{Binding Amount, Mode=TwoWay}" TextAlignment="Right"/>
                                    </DataTemplate>
                                </my:DataGridTemplateColumn.CellTemplate>
                            </my:DataGridTemplateColumn>
                        </my:DataGrid.Columns>
                    </my:DataGrid>
                    <StackPanel Orientation="Horizontal" Grid.Row="3" HorizontalAlignment="Right" Visibility="Collapsed" Name="TaxDiscountStackPanel">
                        <Button Width="25" Margin="2" Name="CancelButton" ToolTip="Cancel" Cursor="Hand">
                            <Button.Template>
                                <ControlTemplate>
                                    <Image Source="/Horizon.HMS;component/Images/desktop_enhancements.png"/>
                                </ControlTemplate>
                            </Button.Template>
                        </Button>
                    </StackPanel>
                    <TextBlock Text="Sub total :" Name="SubtotalTextBlock" HorizontalAlignment="Right" Grid.Column="1" Style="{StaticResource TextBlockStyle}"  Visibility="Collapsed"/>
                    <TextBox Grid.Column="2" Margin="2" Name="SubtotalTextBox"  Visibility="Collapsed"/>
                    <TextBlock Text="Other charges :" HorizontalAlignment="Right" TextDecorations="Underline" Cursor="Hand" Name="OtherChargesTextBlock" Grid.Column="1" Grid.Row="1" Style="{StaticResource TextBlockStyle}"  Visibility="Collapsed"/>
                    <TextBox Grid.Column="2" Margin="2" Grid.Row="1" Name="OtherchargesTextBox" Visibility="Collapsed"/>
                    <TextBlock Text="Net amount :" HorizontalAlignment="Right" Grid.Column="1" Grid.Row="2" Style="{StaticResource TextBlockStyle}"/>
                    <TextBox Grid.Column="2" Margin="2" Grid.Row="2" Name="NetamountTextBox"/>
                </Grid>
            </Grid>
            <StackPanel Name="FindStackPanel">
                <lib:SearchBox x:Name="Ctrl" HorizontalAlignment="Right" Margin="10,5"
					Width="249" Height="22" Mode="{Binding SelectedValue.Content, ElementName=SearchMode}"
					Prompt="Search text" ToolTip="Type to search the current view">
                    <lib:SearchBox.ContextMenu>
                        <ContextMenu>
                            <MenuItem Header="Option 1" IsCheckable="True"/>
                            <MenuItem Header="Option 2" IsCheckable="True"/>
                        </ContextMenu>
                    </lib:SearchBox.ContextMenu>
                    <lib:SearchBox.LayoutTransform>
                        <ScaleTransform ScaleX="{Binding Value, ElementName=Scaler}" 
																						ScaleY="{Binding Value, ElementName=Scaler}"/>
                    </lib:SearchBox.LayoutTransform>
                </lib:SearchBox>
                <extToolkit:BusyIndicator Name="BusyIndicator1" Grid.ColumnSpan="3"/>
                <ScrollViewer Margin="5" MaxHeight="250">
                    <my:DataGrid Grid.Row="2" Name="SearchDataGrid" Style="{StaticResource SerachDataGridStyle}">
                        <my:DataGrid.Columns>
                            <my:DataGridTemplateColumn Width="20">
                                <my:DataGridTemplateColumn.CellTemplate>
                                    <DataTemplate>
                                        <Button Template="{StaticResource DeleteButtonTemp}" Name="DeleteButton" Click="DeleteButton_Click"/>
                                    </DataTemplate>
                                </my:DataGridTemplateColumn.CellTemplate>
                            </my:DataGridTemplateColumn>
                            <my:DataGridTextColumn Header="PI ID" Binding="{Binding PIPONo}"/>
                            <my:DataGridTextColumn Header="Date" Binding="{Binding PIPODate, StringFormat={}{0:dd/MM/yyyy}}"/>
                            <my:DataGridTextColumn Header="Vendor Name" Binding="{Binding VendorName}"/>
                            <my:DataGridTextColumn Header="Sub Total" Binding="{Binding SubTotal}"/>
                            <my:DataGridTextColumn Header="Other Charges" Binding="{Binding OtherCharges}"/>
                            <my:DataGridTextColumn Header="Net Amount" Binding="{Binding NetAmt}"/>
                            <my:DataGridTextColumn Header="Remarks" Binding="{Binding Remarks}"/>
                        </my:DataGrid.Columns>
                    </my:DataGrid>
                </ScrollViewer>
            </StackPanel>
            <local:SidePanel Grid.Row="2" x:Name="TransSidePanel" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Center" Grid.ColumnSpan="2"/>
        </Grid>
    </Border>
</Window>
